package service;

import pojo.School;
import java.util.List;
import static Func.norfunction.getLocalTime;
public class schoolService {
    public static School dao = new School().dao();

    public List<School> getSchoolList(){
        return dao.findAll();
    }

    public boolean deleteByid(String id){
        return dao.deleteById(id);
    }

    public boolean addSchool(String name,String type,String create_year){
        return new School().set("name",name).
                set("type",type).
                set("create_year",create_year).
                set("create_time",getLocalTime()).
                save();
    }

    public School getSchoolById(String id){
        return dao.findById(id);
    }

    public boolean update(String id,String name,String type,String create_year){
        return new School().findById(id).
                set("name",name).
                set("type",type).
                set("create_year",create_year).
                set("create_time",getLocalTime()).
                update();
    }
}
